package io.renren.modules.wmunnormal.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.welderunnormal.entity.WelderunnormalEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.wmunnormal.entity.WmunnormalEntity;
import io.renren.modules.wmunnormal.service.WmunnormalService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-12-21 19:31:47
 */
@RestController
@RequestMapping("wmunnormal/wmunnormal")
public class WmunnormalController {
    @Autowired
    private WmunnormalService wmunnormalService;

    @GetMapping("getWm")
    public List<WmunnormalEntity> getWm(@RequestParam(value = "wmName",required = false) String wmName, @RequestParam(value = "startTime",required = false) String startTime, @RequestParam(value = "endTime",required = false) String endTime){
        return wmunnormalService.getWm(wmName,startTime,endTime);
    }

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("wmunnormal:wmunnormal:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = wmunnormalService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{wmid}")
    @RequiresPermissions("wmunnormal:wmunnormal:info")
    public R info(@PathVariable("wmid") Integer wmid){
		WmunnormalEntity wmunnormal = wmunnormalService.getById(wmid);

        return R.ok().put("wmunnormal", wmunnormal);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("wmunnormal:wmunnormal:save")
    public R save(@RequestBody WmunnormalEntity wmunnormal){
		wmunnormalService.save(wmunnormal);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("wmunnormal:wmunnormal:update")
    public R update(@RequestBody WmunnormalEntity wmunnormal){
		wmunnormalService.updateById(wmunnormal);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("wmunnormal:wmunnormal:delete")
    public R delete(@RequestBody Integer[] wmids){
		wmunnormalService.removeByIds(Arrays.asList(wmids));

        return R.ok();
    }

}
